package 方法的引用.练习;

import 方法的引用.Student;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class 练习一 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list,"张无忌,15","周芷若,14","赵敏,13",
                "张强,20","张三丰,100","张翠山,40","张良,35","王二麻子,37");

        //收集到Student类型的数组中
        Student[] array = list.stream()
                //转化String类型为Student
                .map(Student::new)
                //吧Student类型添加到Student[]
                .toArray(Student[]::new);
        System.out.println(Arrays.toString(array));
    }
}
